# Contributor: Bradley J Chambers <brad.chambers@gmail.com>
# Maintainer: Bradley J Chambers <brad.chambers@gmail.com>
pkgname=pdal
pkgver=2.0.1
pkgrel=6
pkgdesc="PDAL is a C++ BSD library for translating and manipulating point cloud data."
options="!check"
url="https://pdal.io"
# Dependencies libgeotiff-dev, proj-dev, libspatialite-dev, and pcl-dev are
# not provided on other architectures
arch="x86_64" # 1 test fail on the only arch that was installed before, x86_64
license="BSD-2-Clause"
depends="nitro python3 py3-numpy>=1.14.3-r1"
makedepends="
	cmake
	eigen-dev
	hexer-dev
	nitro-dev
	gdal-dev
	geos-dev
	laz-perf-dev
	libgeotiff-dev
	libxml2-dev
	python3-dev
	py3-numpy-dev
	jsoncpp-dev
	hdf5-dev
	proj-dev
	cpd-dev
	fgt-dev
	sqlite-dev
	postgresql-dev
	curl-dev
	laszip-dev
	libspatialite-dev
	linux-headers
	libexecinfo-dev
	pcl-dev
	boost-dev
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/PDAL/PDAL/releases/download/$pkgver/PDAL-$pkgver-src.tar.gz"
builddir="$srcdir/PDAL-$pkgver-src"

build() {
	mkdir build && cd build
	cmake .. \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_PLUGIN_PYTHON=ON \
		-DBUILD_PLUGIN_CPD=ON \
		-DBUILD_PLUGIN_GREYHOUND=ON \
		-DBUILD_PLUGIN_HEXBIN=ON \
		-DBUILD_PLUGIN_NITF=ON \
		-DBUILD_PLUGIN_ICEBRIDGE=ON \
		-DBUILD_PLUGIN_PGPOINTCLOUD=ON \
		-DBUILD_PGPOINTCLOUD_TESTS=OFF \
		-DBUILD_PLUGIN_SQLITE=ON \
		-DBUILD_PLUGIN_PCL=ON \
		-DWITH_LASZIP=ON \
		-DWITH_LAZPERF=ON \
		-DWITH_TESTS=ON
	make
}

package() {
	cd "$builddir"/build
	make DESTDIR="$pkgdir" install
}

check() {
	cd "$builddir"/build
	make test
}

sha512sums="6b33d957d6948a73d0db1b3b47e6b3fa0c3d6efd89e997bfd78a1f801118c68bace4efd5f7e696c9b16d6fb3ebe01d78314c3c92543f28bbc5d46a3a7d1930b4  pdal-2.0.1.tar.gz"
